/**************************
* @Summary  测试函数实现
* @Author 20009200303 赵传博
* @Date 2022/3/31
*****************************/

#include "Test.h"

void Test::Testargument(int argc, char* argv[]) {
    for(int i = 0; i < argc; ++i){
        cout << "Hello, " << argv[i] << endl;
    }
}

void Test::TestTree() {
    string word;
    cin >> word;
    Tnode root;
    if(word != "0") root = {word, 1, nullptr, nullptr};
    cin >> word;
    while(word != "0"){
        insertNode(word, &root);
        cin >> word;
    }
    cout << "trees: " << endl;
    printTrees(&root);
    cout << endl << "Inorder: " << endl;
    printTreesInOrder(&root);

}

void Test::TestTerror() {
    char* name = "spread";
    int age = 19;
    char sex = 'M';
    ErrorUtil::error("Hello, %s is %d and he is %c.\n", name, age, sex);
    ErrorUtil::error("Are you ok?");
}

void Test::TestDate() {
    Date date(2021, 3, 21);
    cout << "Today is " << date << endl;
    cout << "The next day is " << date.plusOneDay() << endl;
    cout << "The next month is " << date.plusOneMonth() << endl;
    cout << "The next year is " << date.plusOneYear() << endl;
    switch (date.date2Calendar()) {
        case 1: cout << "Today is Monday" << endl; break;
        case 2: cout << "Today is Tuesday" << endl; break;
        case 3: cout << "Today is Wednesday" << endl; break;
        case 4: cout << "Today is Thursday" << endl; break;
        case 5: cout << "Today is Friday" << endl; break;
        case 6: cout << "Today is Saturday" << endl; break;
        case 0: cout << "Today is Sunday" << endl; break;
        default: cout << "Error" << endl; break;
    }
    cout << "The next Monthday is " << date.firstMonthday();
}
